/*
 * ThreadSafeMap.cpp
 *
 *  Created on: Nov 16, 2011
 *      Author: gonzalo
 */

#include "ThreadSafeMap.h"

ThreadSafeList::ThreadSafeList() {
}

ThreadSafeList::~ThreadSafeList() {
}

void ThreadSafeList::insert(std::pair<void*, TypeNotifier> pair){
	mutex.lock();
	this->list.push_back(pair);
	mutex.unlock();
}

bool ThreadSafeList::empty(){
	return this->list.empty();
}

std::pair<void*, TypeNotifier> ThreadSafeList::pop(){
	std::pair<void*, TypeNotifier> retorno;

	mutex.lock();
	if(list.empty()){
		mutex.unlock();
		retorno.first = NULL;
		return retorno;
	}



	retorno = list.front();
	list.pop_front();
	mutex.unlock();

	return retorno;
}
